home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d878.lha / DrChip / toproto / toproto.doc < prev    next >
Text File  |  1993-06-14  |  5KB  |  133 lines

  1.                Toproto v1.09 Copyright 1993 Charles E. Campbell, Jr
  2.               ----------------------------------------------------------
  3.  
  4. Copyright:
  5.  
  6.     This program (flist) and associated documents are copyrighted 1993
  7.     by Charles E. Campbell, Jr, PhD.
  8.  
  9.  
  10. Restrictions:
  11.  
  12.     All rights to flist and its documents are reserved, except for those
  13.     explicitly granted herein.
  14.  
  15.     No representation or warranties are made with respect to the accuracy,
  16.     reliability, performance, or operation of this software, and all such
  17.     use is at your own risk.  The author does not assume any responsiblity
  18.     or liability whatsoever with respect to your use of this software.
  19.  
  20.     Toproto may not be included with any commercial product nor may it be
  21.     sold for profit either separately or as part of a compilation without
  22.     the permission of Dr. Charles E. Campbell, Jr.  It may be included in
  23.     non-profit disk collections such as the Fred Fish collection.  It may
  24.     be archived and uploaded to electronic bulletin board systems so long
  25.     as all files remain together and unaltered.  It may be copied to and used on
  26.     individuals' computer systems.
  27.  
  28.  
  29. Author : Dr. Charles E. Campbell, Jr.
  30. Contact: cec@gryphon.gsfc.nasa.gov
  31. Version: 1.09
  32.  
  33.  
  34. Usage:
  35.  
  36.     toproto [options] [filename1 [filename2 [filename3...]]
  37.     toproto "?"
  38.  
  39.  
  40. Options:
  41.  
  42.     -b : body of code not printed
  43.     -B : print both prototype and old style
  44.     -Bstring : print both prototype and old style,
  45.          using "string" instead of default __STDC__ in #ifdef test.
  46.     -c : add variable list comments
  47.     -o : make old-style declarations (ie. not prototypes)
  48.     -r : replace file(s) with their new format (dangerous - use at own risk)
  49.     -t type: use next argument as default type
  50.     -v : report on progress (verbose)
  51.  
  52.  
  53. Explanation:
  54.  
  55.     toproto converts C files to a prototype-using format or to old K&R
  56.     style.  The toproto program will leave the old files with a .bak
  57.     extension when the "-r" option is used.  This program is
  58.  
  59.                 USE-AT-YOUR-OWN-RISK!!!
  60.  
  61.     It has the potential to destroy your files.  Make sure that the output is
  62.     compilable before deleting the *.bak file(s)!  In particular, funky things done
  63.     with the preprocessor may not be understood properly and can cause deleterious
  64.     behavior.
  65.  
  66.     The
  67.  
  68.         toproto "?"
  69.  
  70.     will give you online help.
  71.  
  72.     Normally, toproto will send its output to the stdout (screen).  Of course,
  73.     that means that you can redirect it, filter it, etc.  The -r option does
  74.     allow one to replace files with the prototype'd (or K&R'd) form, but
  75.     *PLEASE* be wary of it!  Again: *I am not responsible or liable for any damage
  76.     done by this program*.
  77.  
  78.     Now that I've said that, I've found toproto highly useful.  It never damages
  79.     *my* source code files, although I've seen it foul up some source issued
  80.     by others (typically, because of funky things done with the preprocessor).
  81.  
  82.     Those of you who #define BEGIN { and #define END } will find that toproto
  83.     does not work for you.  In fact, any of you who don't use { and } properly
  84.     will find toproto does not work for you.
  85.  
  86.     It will change <varargs.h> style to <stdarg.h> style (and vice versa):
  87.  
  88.         <varargs.h> style:              <stdarg.h> style:
  89.         ---------------------------     ------------------------
  90.  
  91.         int yourfunc(arg1,va_alist)     int yourfunc(sometype arg1,...)
  92.         sometype arg1;
  93.         va_dcl
  94.         {                               {
  95.         va_list args;                   va_list args;
  96.         ...                             ...
  97.         va_start(args);                 va_start(arg1,args);
  98.         ...                             ...
  99.         va_end(args);                   va_end(args);
  100.  
  101.  
  102.     The -B flag causes toproto to issue both the new and old style:
  103.  
  104.         int main(int argc,char **argv)
  105.         {
  106.         }
  107.  
  108.     becomes
  109.  
  110.         #ifdef __STDC__
  111.         int main(
  112.           int argc,
  113.           char **argv)
  114.         #else    /* __STDC__ */
  115.         int main(argc,argv)
  116.         int argc;
  117.         char **argv;
  118.         #endif    /* __STDC__ */
  119.         {
  120.         }
  121.  
  122.     If -Bstring is used, the given string will be used instead of __STDC__.
  123.  
  124.     Normally, functions without types are assumed to be of type "int".  The
  125.     "-t type" flag allows one to change that default behavior (for example,
  126.     one may wish to use -t void).
  127.  
  128.     The toproto program was compiled with Aztec C on an A3000 with the following
  129.     options: CCOPTS=-qf -wp -c2 -f8.  Like hdrtag, flist can use <rdcolor.dat>.
  130.  
  131.     Good luck, and let me know of any problems you encounter, and any attaboys
  132.     will be appreciated :).
  133.